import { createRouter, createWebHistory } from 'vue-router';
import BookList from '../components/BookList.vue';
import Home from '../views/Home.vue'


const routes = [
  { path: '/', component: Home },
  { path: '/login', component: () => import('../views/LoginUser.vue') }, // 用户登录页面
  { path: '/login/admin', component: () => import('../views/LoginAdmin.vue') }, // 管理员登录页面
  { path: '/admin', component: () => import('../views/Admin.vue') }, // 管理员界面
  { path: '/book', component: BookList }, //
  { path: '/booklist', component: BookList }, // BookList路由
  { path: '/hot-books', component: () => import('../views/HotBooks.vue') }, // 热门图书页面
  { path: '/BorrowBook', component: () => import('../views/BorrowBook.vue') }, // 热门图书页面
  { path: '/register', component: () => import('../views/RegisterUser.vue') }, // 用户注册页面
];

const router = createRouter({ history: createWebHistory(), routes });
export default router;
//- 功能：定义应用路由规则
// - 特性：配置了 / （首页）、 /admin （管理页）、 /book （图书列表）等核心路径
// - 用途：控制不同URL对应的组件渲染